﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed

#pragma once

#include "WeakReferenceable.h"
#include "ISurface.h"

namespace gcmp
{
    class IPlane;
    class IPolygon;

    /// \brief 裁剪曲面，行为与Face保持一致
    ///
    class ITrimmedSurface : public ISurface, public WeakReferenceable
    {
    public:

        /// \brief   获取几何曲面(拷贝实现)
        /// \return  几何曲面
        virtual OwnerPtr<ISurface> GetUnderlyingSurface() const = 0;


    public:

        /// \brief  是否为平面
        /// \return  是返回True，不是返回False
        virtual bool IsPlanar() const = 0;

        /// \brief  是否为圆柱面
        /// \return  是返回True，不是返回False
        virtual bool IsCylindric() const = 0;

        /// \brief  如果Underlying曲面是平面，则拷贝生成一个新的平面
        /// \param opIPlane 创建的平面
        /// \return  Underlying曲面是平面返回True，不是返回False
        virtual bool GeneratePlane(OwnerPtr<IPlane>& opIPlane) const = 0;

        /// \brief  如果Underlying曲面是为近似平面，则生成包围平面（暂时只处理圆环面）
        /// \param opIPlane 创建的包围平面
        /// \return  Underlying曲面是近似平面返回True，不是返回False
        virtual bool GenerateBoundingPlane(OwnerPtr<IPlane>& opPlane) const = 0;

        /// \brief  根据Face的环创建Polygon
        /// \return  创建出来的polygon，失败返回空指针
        virtual OwnerPtr<IPolygon> CreatePolygon() const = 0;


    public:
        virtual ~ITrimmedSurface() {}
    };
}